//
//  Stack.m
//  iFlickr
//
//  Created by 张 霄鹤 on 09-4-10.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "Stack.h"


@implementation Stack

-(id)init{
	if(self = [super init]){
		data = [[NSMutableArray alloc] initWithCapacity:3];
	}
	return self;
}

-(void)push:(id)obj{
	[data addObject:obj];
}

-(id)peek{
	return [data objectAtIndex:([data count] -1)];
}

-(id)pop{
	id ret = [data objectAtIndex:([data count] -1)];
	[data removeLastObject];
	return ret;
}

-(BOOL)isEmpty{
	return [data count] == 0;
}

-(void)removeAll{
	[data removeAllObjects];
}

-(void) dealloc{
	[data release];
	[super dealloc];
}

@end
